/* Basic64加密 */
let Base64 = require('js-base64').Base64;
export const basic64Encode = (str) => {
	return Base64.encode(str)
}

// 换算真实的px (设计稿的宽度 375px)
export const realPx = (px) => {
  const maxWidth = window.innerWidth > 500 ? 500 : window.innerWidth
  return px * (maxWidth / 375)
}

//字符串 arge 拆分成数组
export const strSpilt = (str, arge='') => {
	return str.toString().split(arge)
}

//数组 转字符串 以'x'连接,默认 ','相连
export const arrToStrWith = (arr, arge=',') => {
	return arr.join(arge)
}

//数组随机取x条数据
export const getRandomArray = (arr, count) => {
    var shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
    while (i-- > min) {
        index = Math.floor((i + 1) * Math.random());
        temp = shuffled[index];
        shuffled[index] = shuffled[i];
        shuffled[i] = temp;
    }
    return shuffled.slice(min);
}
